//
//  DrawerTableViewCell.m
//  SmileRead
//
//  Created by dllo on 15/8/30.
//  Copyright (c) 2015年 JIZ. All rights reserved.
//

#import "DrawerTableViewCell.h"
#import "Path.h"

@interface DrawerTableViewCell ()

@property (nonatomic, retain) UIImageView *titleImage;
@property (nonatomic, retain) UILabel *titleLabel;

@end



@implementation DrawerTableViewCell



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.titleImage = [[UIImageView alloc] init];
        [self.contentView addSubview:self.titleImage];
        //self.titleImage.backgroundColor = [UIColor redColor];
        [_titleLabel release];
        
        
        self.titleLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.titleLabel];
        //self.titleLabel.backgroundColor = [UIColor greenColor];
        [_titleLabel release];
        
    }
    return self;
}


- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.titleImage.frame = CGRectMake(10 * widthFit, 5 * heightFit, 50 * heightFit, 50 * heightFit);
    
    self.titleLabel.frame = CGRectMake(70 * widthFit, 5 * heightFit, self.contentView.frame.size.width - 70 * widthFit, 50 * heightFit);
    
}

- (void)receiveImageName:(NSString *)imageName title:(NSString *)title
{
    self.imageView.image = [UIImage imageWithContentsOfFile:[Path pathOfImageWithName:imageName]];
    self.titleLabel.text = title;
}


- (void)dealloc
{
    [_titleImage release];
    [_titleLabel release];
    [super dealloc];
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
